home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / lib / partman / active_partition / 45ext3 / choices next >
Encoding:
Text File  |  2009-04-19  |  2.3 KB  |  104 lines

  1. #!/bin/sh
  2.  
  3. . /usr/share/debconf/confmodule
  4.  
  5. set -e
  6.  
  7. dev=$1
  8. id=$2
  9. part=$dev/$id
  10.  
  11. cd $dev
  12.  
  13. [ -f $part/method -a -f $part/acting_filesystem ] || exit 0
  14.  
  15. filesystem=$(cat $part/acting_filesystem)
  16.  
  17. case "$filesystem" in
  18.     ext3|ext4)
  19.     :
  20.     ;;
  21.     *)
  22.     exit 0
  23.     ;;
  24. esac
  25.  
  26. choice_mountpoint () {
  27.     if [ -f $part/mountpoint ]; then
  28.         mp=$(cat $part/mountpoint)
  29.     else
  30.         db_metaget partman-basicfilesystems/text/no_mountpoint description
  31.         mp="$RET"
  32.     fi
  33.     db_metaget partman-ext3/text/specify_mountpoint description
  34.     printf "mountpoint\t%s\${!TAB}%s\n" "$RET" "$mp"
  35. }
  36.  
  37. choice_options () {
  38.     db_metaget partman-basicfilesystems/text/options description
  39.     printf "options\t%s\${!TAB}%.45s\n" "$RET" "$(get_mountoptions $dev $id)"
  40. }
  41.  
  42. choice_label () {
  43.     # allow to set label only if the partition is to be formatted
  44.     [ -f $part/format ] || return 0
  45.     [ ! -f $part/formatted \
  46.       -o $part/formatted -ot $part/method \
  47.       -o $part/formatted -ot $part/filesystem ] || return 0
  48.     case "$filesystem" in
  49.         ext3|ext4)
  50.         if [ -f $part/label ]; then
  51.             label=$(cat $part/label)
  52.         else
  53.             db_metaget partman-basicfilesystems/text/none description
  54.             label=$RET
  55.         fi
  56.         db_metaget partman-basicfilesystems/text/specify_label description
  57.         printf "label\t%s\${!TAB}%s\n" "$RET" "$label"
  58.         ;;
  59.     esac
  60. }
  61.  
  62. choice_reserved () {
  63.     local reserved
  64.     # allow to set reserved space only if the partition is to be formatted
  65.     [ -f $part/format ] || return 0
  66.     [ ! -f $part/formatted \
  67.       -o $part/formatted -ot $part/method \
  68.       -o $part/formatted -ot $part/filesystem ] || return 0
  69.     if [ -f $part/reserved_for_root ]; then
  70.         reserved=$(cat $part/reserved_for_root)
  71.     else
  72.         reserved=5
  73.     fi
  74.     db_metaget partman-basicfilesystems/text/reserved_for_root description
  75.     printf "reserved_for_root\t%s\${!TAB}%s\n" "$RET" "$reserved%"
  76. }
  77.  
  78. choice_usage () {
  79.     local usage
  80.     # allow to set usage only if the partition is to be formatted
  81.     [ -f $part/format ] || return 0
  82.     [ ! -f $part/formatted \
  83.       -o $part/formatted -ot $part/method \
  84.       -o $part/formatted -ot $part/filesystem ] || return 0
  85.     if [ -f $part/usage ]; then
  86.         usage=$(cat $part/usage)
  87.     else
  88.         db_metaget partman-basicfilesystems/text/typical_usage description
  89.         usage=$RET
  90.     fi
  91.     db_metaget partman-basicfilesystems/text/usage description
  92.     printf "usage\t%s\${!TAB}%s\n" "$RET" "$usage"
  93. }
  94.  
  95. choice_mountpoint
  96.  
  97. choice_options
  98.  
  99. choice_label
  100.  
  101. choice_reserved
  102.  
  103. choice_usage
  104.